package com.scs.application.core.utils;

import com.alibaba.fastjson.JSONArray;

import java.net.InetAddress;

public class Tools {
    public static int findJsonArray(JSONArray arr, String key, String keyValue) {
        int index = -1;
        for (int i=0;i<arr.size();i++) {
            if (arr.getJSONObject(i).getString(key).equalsIgnoreCase(keyValue)) {
                index = i;
                break;
            }
        }
        return index;
    }
    public static String getHostName() {
        try {
            InetAddress localhost = InetAddress.getLocalHost();
            return localhost.getHostName();
        } catch (Exception ex) {
            return "";
        }
    }
}
